﻿//------------------------------------------------------------------------------
//  此代码版权声明为全文件覆盖，如有原作者特别声明，会在下方手动补充
//  此代码版权（除特别声明外的代码）归作者本人Diego所有
//  源代码使用协议遵循本仓库的开源协议及附加协议
//  Gitee源代码仓库：https://gitee.com/diego2098/ThingsGateway
//  Github源代码仓库：https://github.com/kimdiego2098/ThingsGateway
//  使用文档：https://thingsgateway.cn/
//  QQ群：605534569
//------------------------------------------------------------------------------

using ThingsGateway.Foundation.Dlt645;
using ThingsGateway.Foundation.Modbus;
using ThingsGateway.Foundation.SiemensS7;

namespace ThingsGateway.Foundation;

internal class Program
{
    private static async Task Main(string[] args)
    {
        byte[] bytes = [0x11, 0xFE, 0xFE, 0xFE, 0xFE, 0x68, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x68, 0x91, 0x07, 0x33, 0x34, 0x34, 0x35, 0x33, 0x59, 0x36, 0x60, 0x16];
        TestHelpers.TestAdapter<Dlt645_2007Message>(bytes);
        bytes = [0x00, 0x00, 0x00, 0x00, 0x00, 0x2F, 0x01, 0x03, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
        TestHelpers.TestAdapter<ModbusTcpMessage>(bytes);
        bytes = [0x01, 0x03, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x59];
        TestHelpers.TestAdapter<ModbusRtuMessage>(bytes);


        bytes = [0x03, 0x00, 0x00, 0x21, 0x02, 0xF0, 0x80, 0x32, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x00, 0x04, 0x01, 0xFF, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
        TestHelpers.TestAdapter<S7Message>(bytes);
        bytes = [0x03, 0x00, 0x00, 0x23, 0x02, 0xF0, 0x80, 0x32, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0E, 0x00, 0x00, 0x04, 0x01, 0xFF, 0x09, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
        TestHelpers.TestAdapter<S7Message>(bytes);



        //await ModbusMasterTest.Test().ConfigureAwait(false);
        await S7MasterTest.Test().ConfigureAwait(false);
    }
}
